package com.bnz.service.impl;

import com.bnz.mapper.DishMapper;
import com.bnz.pojo.Dish;
import com.bnz.service.DishService;
import com.bnz.util.DbUtils;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;
import java.util.List;

public class DishServiceImpl implements DishService {
    @Override
    public List<Dish> findAll() throws IOException {
        try (SqlSession sqlSession = DbUtils.getSqlSession()) {
            DishMapper mapper = sqlSession.getMapper(DishMapper.class);
            List<Dish> dishes = mapper.findAll();
            System.out.println("查询成功");
            return dishes;
        }
    }
}
